using System.ComponentModel;
using MySqlConnector;

namespace Front._1117;

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        OpenFileDialog openFileDialog1 = new OpenFileDialog();
        if (openFileDialog1.ShowDialog() == DialogResult.OK)
        {
            //执行头像上传
            string fileName = openFileDialog1.FileName;
            File.Copy(fileName, "D:\\1117\\"+Path.GetFileName(fileName));
        }
    }

    private void button2_Click(object sender, EventArgs e)
    {
        using var connection = new MySqlConnection("Server=myserver;User ID=mylogin;Password=mypass;Database=mydatabase");
        connection.Open();

        using var command = new MySqlCommand("SELECT field FROM table;", connection);
        using var reader = command.ExecuteReader();
        while (reader.Read())
            Console.WriteLine(reader.GetString(0));    }
    
    
}
        